"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.NewsData = void 0;
var idDone = false;
console.log("wxq");
// let name: string = "Jacky";
// name = "Tom";
// name = 'Mick';
var list = [1, 2, 3, 4];
var x;
x = ["hello", 10];
var Color;
(function (Color) {
    Color[Color["Red"] = 0] = "Red";
    Color[Color["Green"] = 1] = "Green";
    Color[Color["Blue"] = 2] = "Blue";
})(Color || (Color = {}));
;
var c;
var notSure = 4;
notSure = 'maybe a string instead';
notSure = false;
function test() {
    console.log('This is function is void');
}
// Null 和 Undefined
var u = undefined;
var n = null;
// 联合类型
var myFavoriteNumber;
myFavoriteNumber = 'wxq';
myFavoriteNumber = 111;
//条件语句
var num = 5;
if (num > 0) {
    console.log("shu.");
}
//if...else 语句
var num2 = 12;
if (num2 % 2 == 0) {
}
else if (1) {
}
else {
}
var grade = "A";
switch (grade) {
    case "a": {
    }
    case 'b': {
        break;
    }
}
function add(x, y) {
}
var myAdd = function (x, y) {
    return x + y;
};
// 有名函数：给变量设置为number类型
function add2(x, y) {
    return x + y;
}
// 匿名函数：给变量设置为number类型
var myAdd2 = function (x, y) {
    return x + y;
};
// 可选参数
function buildName(firstName, lastname) {
    if (lastname) {
        return firstName + ' ' + lastname;
    }
    else {
        return firstName;
    }
}
var result1 = buildName('Bob');
var result2 = buildName('Bob', 'Adams');
console.log(result1 + result2);
// 剩余参数
function getEmployeeName(firstName) {
    var resetOfName = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        resetOfName[_i - 1] = arguments[_i];
    }
    return firstName + ' ' + resetOfName.join(' ');
}
// 箭头函数
function testNumber(num) {
    if (num > 0) {
        console.log(num + ' 是正数');
    }
    else if (num < 0) {
        console.log(num + ' 是负数');
    }
    else {
        console.log(num + ' 为0');
    }
}
var testArrowFun = function (num) {
    if (num > 0) {
        console.log(num + ' 是正数');
        return "返回是正数";
    }
    else if (num < 0) {
        console.log(num + ' 是负数');
        return "返回是负数";
    }
    else {
        console.log(num + ' 为0');
        return "返回为0";
    }
};
testArrowFun(-1);
console.log(testArrowFun(1));
//类
var Person = /** @class */ (function () {
    function Person(name, age) {
        this.name = name;
        this.age = age;
    }
    Person.prototype.getPersonInfo = function () {
        return "My name is ".concat(this.name, " and age is ").concat(this.age);
    };
    return Person;
}());
var person1 = new Person('Jacky', 18);
person1.getPersonInfo();
var Employee = /** @class */ (function (_super) {
    __extends(Employee, _super);
    function Employee(name, age, department) {
        var _this = _super.call(this, name, age) || this;
        _this.department = department;
        return _this;
    }
    Employee.prototype.getEmployeeInfo = function () {
        return this.getPersonInfo() + " and work in ".concat(this.department);
    };
    return Employee;
}(Person));
var person2 = new Employee('Tom', 28, 'HuaWei');
person2.getPersonInfo();
person2.getEmployeeInfo();
// 模块
var NewsData = /** @class */ (function () {
    function NewsData(title, content, imagesUrl, source) {
        this.title = title;
        this.content = content;
        this.imagesUrl = imagesUrl;
        this.source = source;
    }
    return NewsData;
}());
exports.NewsData = NewsData;
// 迭代器
var somearray = [1, 'string', false];
for (var _i = 0, somearray_1 = somearray; _i < somearray_1.length; _i++) {
    var entry = somearray_1[_i];
    console.log(entry.toString());
}
var list2 = [4, 5, 6];
for (var list2Key in list2) {
    console.log(list2Key);
}
for (var _a = 0, list2_1 = list2; _a < list2_1.length; _a++) {
    var i = list2_1[_a];
    console.log(i); // "4", "5", "6"
}
